package com.ys.enume.storage;


import java.util.ArrayList;
import java.util.List;

//FBA装箱单母表
public class TccFbaBoxUpEnum {
	
	/*
	 * 货件状态
	 */
	public enum BoxState {
		NOT_UP("未配货", 0),
		YES_UP("已装箱", 1),
		YES_CANCEL("已取消", 2),
		YES_PASS("已审核", 3),
		YES_DIS("已配货", 4),
		YES_CHOOSE("方案已选择", 5),
		;
		public String name;
		public Integer value;

		private BoxState(String name, Integer value) {
			this.name = name;
			this.value = value;
		}

		public static String getName(int value) {
			for (BoxState e : BoxState.values()) {
				if (e.value == value) {
					return e.name;
				}
			}

			return "";
		}

		//验证状态是否包含
		public static boolean checkStatus(List<BoxState> list,Integer checkValue) {
			boolean statusIsPass = false;
			for(BoxState boxState:list){
				if(boxState.value.equals(checkValue)){
					statusIsPass = true;
					break;
				}
			}
			return statusIsPass;
		}

		public static String getNameStrByList(List<BoxState> list) {
			StringBuilder res = new StringBuilder();
			for(BoxState item:list){
				if(res.length()>0){
					res.append("、");
				}
				res.append(item.name);
			}
			return res.toString();
		}


		public static String getValueSearchByList(List<BoxState> list) {
			StringBuilder res = new StringBuilder();
			for(BoxState item:list){
				if(res.length()>0){
					res.append(",");
				}
				res.append(item.value);
			}
			return res.toString();
		}

		//可以默认查询的状态
		public static List<BoxState> getSearchStatus() {
			List<BoxState> list = new ArrayList<>();
			list.add(BoxState.NOT_UP);//未配货
			list.add(BoxState.YES_DIS);//已配货
			list.add(BoxState.YES_UP);//已装箱
			list.add(BoxState.YES_CHOOSE);//方案已选择
			return list;
		}


		//可以进行修改信息的状态
		public static List<BoxState> getEditInfo() {
			List<BoxState> list = new ArrayList<>();
			list.add(BoxState.NOT_UP);//未配货
			list.add(BoxState.YES_DIS);//已配货
			list.add(BoxState.YES_UP);//已装箱
			return list;
		}
	}
}
